sgdk
|
VDP background plan support. More...
Go to the source code of this file.
Classes | |
struct | Image |
Functions | |
void | VDP_setHorizontalScroll (VDPPlan plan, s16 value) |
Set plan horizontal scroll (plain scroll mode). 3 horizontal scroll modes are supported: | |
void | VDP_setHorizontalScrollTile (VDPPlan plan, u16 tile, s16 *values, u16 len, u16 use_dma) |
Set plan horizontal scroll (tile scroll mode). 3 horizontal scroll modes are supported: | |
void | VDP_setHorizontalScrollLine (VDPPlan plan, u16 line, s16 *values, u16 len, u16 use_dma) |
Set plan horizontal scroll (line scroll mode). 3 horizontal scroll modes are supported: | |
void | VDP_setVerticalScroll (VDPPlan plan, s16 value) |
Set plan vertical scroll (plain scroll mode). 2 vertical scroll modes are supported: | |
void | VDP_setVerticalScrollTile (VDPPlan plan, u16 tile, s16 *values, u16 len, u16 use_dma) |
Set plan vertical scroll (2-Tiles scroll mode). 2 vertical scroll modes are supported: | |
void | VDP_clearPlan (u16 plan, u8 use_dma) |
Clear specified plan. | |
VDPPlan | VDP_getTextPlan () |
Returns the plan used to display text. | |
u16 | VDP_getTextPalette () |
Returns the palette number used to display text. | |
u16 | VDP_getTextPriority () |
Returns the priority used to display text. | |
void | VDP_setTextPlan (VDPPlan plan) |
Define the plan to use to display text. | |
void | VDP_setTextPalette (u16 palette) |
Define the palette to use to display text. | |
void | VDP_setTextPriority (u16 prio) |
Define the priority to use to display text. | |
void | VDP_drawText (const char *str, u16 x, u16 y) |
Draw text. | |
void | VDP_clearText (u16 x, u16 y, u16 w) |
Clear text. | |
void | VDP_clearTextLine (u16 y) |
Clear a complete line of text. | |
void | VDP_drawTextBG (u16 plan, const char *str, u16 flags, u16 x, u16 y) |
Draw text in backgound plan. | |
void | VDP_clearTextBG (u16 plan, u16 x, u16 y, u16 w) |
Clear text from background plan. | |
void | VDP_clearTextLineBG (u16 plan, u16 y) |
Clear a complete line of text from background plan. | |
u16 | VDP_drawBitmap (u16 plan, const Bitmap *bitmap, u16 x, u16 y) |
Draw Bitmap in specified background plan and at given position. | |
u16 | VDP_drawBitmapEx (u16 plan, const Bitmap *bitmap, u16 basetile, u16 x, u16 y, u16 loadpal) |
Draw Bitmap in specified background plan and at given position. | |
u16 | VDP_drawImage (u16 plan, const Image *image, u16 x, u16 y) |
Draw Map in specified background plan and at given position. | |
u16 | VDP_drawImageEx (u16 plan, const Image *image, u16 basetile, u16 x, u16 y, u16 loadpal, u16 use_dma) |
Draw Map at the specified plan position. | |
Variables | |
u16 | curTileInd |
VDP background plan support.
This unit provides plan A & plan B facilities :
void VDP_clearPlan | ( | u16 | plan, |
u8 | use_dma | ||
) |
Clear specified plan.
plan | Plan we want to clear. Accepted values are:
|
use_dma | Use DMA or software clear. |
Using DMA permit faster clear operation but can lock Z80 execution.
void VDP_clearText | ( | u16 | x, |
u16 | y, | ||
u16 | w | ||
) |
Clear text.
x | X position (in tile). |
y | y position (in tile). |
w | width to clear (in tile). |
This method uses VDP_PLAN_A to draw/clear the text.
void VDP_clearTextBG | ( | u16 | plan, |
u16 | x, | ||
u16 | y, | ||
u16 | w | ||
) |
Clear text from background plan.
plan | Plan where we want to clear text. Accepted values are:
|
x | X position (in tile). |
y | y position (in tile). |
w | width to clear (in tile). |
void VDP_clearTextLine | ( | u16 | y | ) |
Clear a complete line of text.
y | y position (in tile). |
This method uses VDP_PLAN_A to draw/clear the text.
void VDP_clearTextLineBG | ( | u16 | plan, |
u16 | y | ||
) |
Clear a complete line of text from background plan.
plan | Plan where we want to clear text. Accepted values are:
|
y | y position (in tile). |
u16 VDP_drawBitmap | ( | u16 | plan, |
const Bitmap * | bitmap, | ||
u16 | x, | ||
u16 | y | ||
) |
Draw Bitmap in specified background plan and at given position.
plan | Plan where we want to draw the bitmap. Accepted values are:
|
bitmap | Genesis bitmap (the width and height should be aligned to 8). The Bitmap is unpacked "on the fly" if needed (require some memory). |
x | Plan X position (in tile). |
y | Plan Y position (in tile). |
This function does "on the fly" 4bpp bitmap conversion to tile data and transfert them to VRAM.
It's very helpful when you use bitmap images but the conversion eats sometime so you should use it only for static screen only.
For "in-game" condition you should use VDP_loadTileData() method with prepared tile data.
u16 VDP_drawBitmapEx | ( | u16 | plan, |
const Bitmap * | bitmap, | ||
u16 | basetile, | ||
u16 | x, | ||
u16 | y, | ||
u16 | loadpal | ||
) |
Draw Bitmap in specified background plan and at given position.
plan | Plan where we want to draw the bitmap. Accepted values are:
|
bitmap | Genesis bitmap (the width and height should be aligned to 8). The Bitmap is unpacked "on the fly" if needed (require some memory). |
basetile | Base tile attributes data (see TILE_ATTR_FULL() macro). |
x | Plan X position (in tile). |
y | Plan Y position (in tile). |
loadpal | Load the bitmap palette information when non zero. |
This function does "on the fly" 4bpp bitmap conversion to tile data and transfert them to VRAM.
It's very helpful when you use bitmap images but the conversion eats sometime so you should use it only for static screen only.
For "in-game" condition you should use VDP_loadTileData() method with prepared tile data.
u16 VDP_drawImage | ( | u16 | plan, |
const Image * | image, | ||
u16 | x, | ||
u16 | y | ||
) |
Draw Map in specified background plan and at given position.
plan | Plan where we want to draw the map. Accepted values are:
|
image | Image structure to draw. The Image is unpacked "on the fly" if needed (require some memory). |
x | Plan X position (in tile). |
y | Plan Y position (in tile). |
Load the image tiles data in VRAM and display it at specified tilemap region.
u16 VDP_drawImageEx | ( | u16 | plan, |
const Image * | image, | ||
u16 | basetile, | ||
u16 | x, | ||
u16 | y, | ||
u16 | loadpal, | ||
u16 | use_dma | ||
) |
Draw Map at the specified plan position.
plan | Plan where we want to load map. Accepted values are:
|
image | Image structure to draw. The Image is unpacked "on the fly" if needed (require some memory). |
basetile | Base tile attributes data (see TILE_ATTR_FULL() macro). |
x | Plan X position (in tile). |
y | Plan Y position (in tile). |
loadpal | Load the bitmap palette information when non zero. Accepted values are: 0 = don't load palette. 1 = HIGH PRIORITY TILE. 0: |
use_dma | Use DMA transfert (faster but can lock Z80 execution). |
Load the image tiles data in VRAM and display it at specified tilemap region.
void VDP_drawText | ( | const char * | str, |
u16 | x, | ||
u16 | y | ||
) |
Draw text.
str | String to draw. |
x | X position (in tile). |
y | y position (in tile). |
This method uses VDP_PLAN_A to draw the text.
See VDP_setTextPalette() and VDP_setTextPriority().
void VDP_drawTextBG | ( | u16 | plan, |
const char * | str, | ||
u16 | flags, | ||
u16 | x, | ||
u16 | y | ||
) |
Draw text in backgound plan.
plan | Plan we want to use to draw text. Accepted values are:
|
str | String to draw. |
flags | tile flags (see TILE_ATTR macro). |
x | X position (in tile). |
y | y position (in tile). |
This method uses the specified plan to draw the text.
Each character fit in one tile (8x8 pixels).
u16 VDP_getTextPalette | ( | ) |
Returns the palette number used to display text.
VDPPlan VDP_getTextPlan | ( | ) |
Returns the plan used to display text.
Returned value should be either PLAN_A or PLAN_B.
u16 VDP_getTextPriority | ( | ) |
Returns the priority used to display text.
void VDP_setHorizontalScroll | ( | VDPPlan | plan, |
s16 | value | ||
) |
Set plan horizontal scroll (plain scroll mode).
3 horizontal scroll modes are supported:
plan | Plan we want to set the horizontal scroll. Accepted values are:
|
value | H scroll offset. Negative value will move the plan to the left while positive value will move it to the right. |
void VDP_setHorizontalScrollLine | ( | VDPPlan | plan, |
u16 | line, | ||
s16 * | values, | ||
u16 | len, | ||
u16 | use_dma | ||
) |
Set plan horizontal scroll (line scroll mode).
3 horizontal scroll modes are supported:
plan | Plan we want to set the horizontal scroll. Accepted values are:
|
line | First line we want to set the horizontal scroll. |
values | H scroll offsets. Negative values will move the plan to the left while positive values will move it to the right. |
len | Number of line to set. |
use_dma | Use DMA flag (faster for large transfer). |
void VDP_setHorizontalScrollTile | ( | VDPPlan | plan, |
u16 | tile, | ||
s16 * | values, | ||
u16 | len, | ||
u16 | use_dma | ||
) |
Set plan horizontal scroll (tile scroll mode).
3 horizontal scroll modes are supported:
plan | Plan we want to set the horizontal scroll. Accepted values are:
|
tile | First tile we want to set the horizontal scroll. |
values | H scroll offsets. Negative values will move the plan to the left while positive values will move it to the right. |
len | Number of tile to set. |
use_dma | Use DMA flag (faster for large transfer). |
void VDP_setTextPalette | ( | u16 | palette | ) |
Define the palette to use to display text.
palette | Palette number. |
void VDP_setTextPlan | ( | VDPPlan | plan | ) |
Define the plan to use to display text.
plan | Plan where to display text. Accepted values are: PLAN_A PLAN_B |
void VDP_setTextPriority | ( | u16 | prio | ) |
Define the priority to use to display text.
prio | Priority: 1 = HIGH PRIORITY TILE. 0 = LOW PRIORITY TILE. |
void VDP_setVerticalScroll | ( | VDPPlan | plan, |
s16 | value | ||
) |
Set plan vertical scroll (plain scroll mode). 2 vertical scroll modes are supported:
plan | Plan we want to set the vertical scroll. Accepted values are:
|
value | V scroll offset. Negative value will move the plan down while positive value will move it up. |
void VDP_setVerticalScrollTile | ( | VDPPlan | plan, |
u16 | tile, | ||
s16 * | values, | ||
u16 | len, | ||
u16 | use_dma | ||
) |
Set plan vertical scroll (2-Tiles scroll mode). 2 vertical scroll modes are supported:
plan | Plan we want to set the vertical scroll. Accepted values are:
|
tile | First tile we want to set the vertical scroll. |
values | V scroll offsets. Negative values will move the plan down while positive values will move it up. |
len | Number of tile to set. |
use_dma | Use DMA flag (faster for large transfer). |
u16 curTileInd |
Contains current VRAM tile position where we will upload next tile data.